package com.cskaoyan.app.controller;

import com.cskaoyan.app.bean.common.BaseRespVo;
import com.cskaoyan.app.bean.vo.AdminConfigExpressVO;
import com.cskaoyan.app.bean.vo.AdminConfigMallVO;
import com.cskaoyan.app.bean.vo.AdminConfigOrderVO;
import com.cskaoyan.app.bean.vo.AdminConfigWxVO;
import com.cskaoyan.app.service.AdminConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("admin/config")
public class AdminConfigController {

    @Autowired
    private AdminConfigService adminConfigService;

    @GetMapping("mall")
    public Object mall() {
        AdminConfigMallVO data = adminConfigService.mall();
        return BaseRespVo.ok(data);
    }

    @PostMapping("mall")
    public Object mall(@RequestBody AdminConfigMallVO mallVO) {
        adminConfigService.mall(mallVO);
        return BaseRespVo.ok();
    }

    @GetMapping("express")
    public Object express() {
        AdminConfigExpressVO data = adminConfigService.express();
        return BaseRespVo.ok(data);
    }

    @PostMapping("express")
    public Object express(@RequestBody AdminConfigExpressVO expressVO) {
        adminConfigService.express(expressVO);
        return BaseRespVo.ok();
    }

    @GetMapping("order")
    public Object order() {
        AdminConfigOrderVO data = adminConfigService.order();
        return BaseRespVo.ok(data);
    }

    @PostMapping("order")
    public Object order(@RequestBody AdminConfigOrderVO orderVO) {
        adminConfigService.order(orderVO);
        return BaseRespVo.ok();
    }

    @GetMapping("wx")
    public Object wx() {
        AdminConfigWxVO data = adminConfigService.wx();
        return BaseRespVo.ok(data);
    }

    @PostMapping("wx")
    public Object wx(@RequestBody AdminConfigWxVO wxVO) {
        adminConfigService.wx(wxVO);
        return BaseRespVo.ok();
    }
}
